import request from "@/utils/request";

interface blogListParams {
  recommendStatus: number,
  current?: number,
  pageSize?: number,
  showStatus?: number
}
export const getBlog = (params:blogListParams) => {
  return request({
    url: "/api/cms/blog/queryBlogList",
    method: "get",
    params
  })
}
interface updateBlogStatusParams {
  ids:Array<number>,
  showStatus:number
}
export const updateBlogStatus = (data:updateBlogStatusParams) => {
  return request({
    url: "/api/cms/blog/updateBlogStatus",
    method: "post",
    data
  })
}
interface deleteBlogParams {
  ids:Array<number>
}
export const deleteBlog = (data:deleteBlogParams) => {
  return request({
    url: "/api/cms/blog/deleteBlog",
    method: "post",
    data
  })
}
interface addBlogParams {
  recommendStatus:number,
  title?:string,
  pic?:string,
  showStatus?:number,
  sort?:number,
  description?:string,
  content?:string,
}
export const addBlog = (data:addBlogParams) => {
  return request({
    url: "/api/cms/blog/addBlog",
    method: "post",
    data
  })
}
interface updateBlogParams {
  id?:number,
  name?:string,
  pic?:string,
  status?:number,
  url?:string,
  sort?:number,
  subTitle?:string,
  button1?:string,
  button2?:string,
  Product?:number
}
export const updateBlog = (data:updateBlogParams) => {
  return request({
    url: "/api/cms/blog/updateBlog",
    method: "post",
    data
  })
}

export const uploadImg = (data: any) => {
  return request({
    url: "/api/picture/upload",
    method: "post",
    data
  })
}